# coding = utf-8


# def fib(maxNum):
#     n, a, b = 0, 0, 1
#     while n < maxNum:
#         print(b)
#         a, b = b, a+b
#         n = n+1
#     return "done"
#
#
# fib(10)


def fib(maxNum):
    n, a, b = 0, 0, 1
    while n < maxNum:
        yield b
        a, b = b, a+b
        n = n+1
    return "done"


# print(fib(10))
f = fib(10)
print(f.__next__())
print(f.__next__())
print(f.__next__())
print(f.__next__())
# 使用 f.__next__ 打印的；
# 使用 f.__next__ 取多了，会报异常出错；

print("======o o======")

for i in f:
    print(i)
